<template>
  <a-select
    v-model:value="val"
    style="width: 120px"
    ref="select"
    @change="change"
  >
    <a-select-option v-for="item of options" :key="item.value" :value="item.value" v-bind="$attrs">{{item.label}}</a-select-option>
  </a-select>
</template>
  
<script>
import { ref } from '@vue/reactivity';
export default {
  props: {
     currentVal:{
        type: String,
        required: true  
     },
     options:{
        type: Array,
        required: true
     }
  },
  setup(props,{emit}) {
    //响应数据
    const val = ref(props.currentVal)
    //双向数据绑定
    const change = (value) => {
    emit("update:currentVal",value)  
    };
    return{
        val,
        change
    }
  },
};
</script>

<style>
</style>